<%--
  User: Егор
  Date: 06.08.12
  Time: 17:12
--%>
<script type="text/javascript">


    jq(function() {
        jq("#grid").jqGrid({
            url:'/#',
            datatype: 'json',
            mtype: 'GET',
            colNames:['ID','Employee Name','Week','Lodging', 'Meals','Transportation','Personal','Misc','Total','Action'],
            colModel:[
                {name:'id',index:'id',editable:false,editoptions:{readonly:true,size:10},hidden:true},
                {name:'employee_name',index:'employee_name', width:55,align: "center",editable:false},
                {name:'week',index:'week', width:55,align: 'center',editable:false},
                {name:'lodging',index:'lodging', width:55,align: "center",editable:false},
                {name:'meals',index:'meals', width:55,align: "center",editable:false},
                {name:'transportation',index:'transportation', width:55,align: "center",editable:false},
                {name:'personal',index:'personal', width:55,align: "center",editable:false},
                {name:'misc',index:'misc', width:55,align: "center",editable:false},
                {name:'total',index:'total', width:55,align: "center",editable:false},
                {name:'action',index:'action', width:55,align: "center",editable:false}
            ],
            postData: {
            },
            rowNum:20,
            rowList:[20,40,60],
            height: 200,
            autowidth: true,
            rownumbers: true,
            pager: '#pager',
            sortname: 'id',
            viewrecords: true,
            sortorder: "asc",
            caption:"Approver History",
            emptyrecords: "Empty records",
            loadonce: false,
            loadComplete: function() {
            },
            gridComplete: function(){
                var ids = jQuery("#grid").jqGrid('getDataIDs');
                for(var i=0;i < ids.length;i++){
                    var recordId = ids[i];
                    generate_button = "<input style='height:22px;width:50px;' type='button' value='Generate' onclick=\"#\"  />";
                    jQuery("#grid").jqGrid('setRowData',ids[i],{act:generate_button});
                }
            },
            jsonReader : {
                root: "rows",
                page: "pageNumber",
                total: "pageCount",
                records: "recordsCount",
                repeatitems: false,
                cell: "cell",
                id: "id"
            }
        });
        jq("#grid").jqGrid('navGrid','#pager',
                {edit:false,add:false,del:false,search:true},
                { },
                { },
                { },
                {
                    sopt:['eq', 'ne', 'lt', 'gt', 'cn', 'bw', 'ew'],
                    closeOnEscape: true,
                    multipleSearch: true,
                    closeAfterSearch: true }
        );

    });
</script>

<div id="jqgrid">
    <table id="grid"></table>
    <div id="pager"></div>
</div>

<div id="dialog" title="Feature not supported" style="display:none">
    <p>That feature is not supported.</p>
</div>
